home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frm7_1_5
- Caption = "World Series Winners"
- ClientHeight = 1440
- ClientLeft = 1755
- ClientTop = 2775
- ClientWidth = 6615
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 1440
- ScaleWidth = 6615
- Begin VB.PictureBox picSeriesWon
- Height = 615
- Left = 120
- ScaleHeight = 555
- ScaleWidth = 6315
- TabIndex = 3
- Top = 720
- Width = 6375
- End
- Begin VB.CommandButton cmdDidTheyWin
- Caption = "Did they win?"
- Default = -1 'True
- Height = 495
- Left = 4320
- TabIndex = 2
- Top = 120
- Width = 1695
- End
- Begin VB.TextBox txtName
- Height = 285
- Left = 2520
- TabIndex = 1
- Top = 240
- Width = 1575
- End
- Begin VB.Label lblName
- Alignment = 1 'Right Justify
- Caption = "Name of baseball team:"
- Height = 255
- Left = 360
- TabIndex = 0
- Top = 240
- Width = 2055
- End
- Attribute VB_Name = "frm7_1_5"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- 'Create form-level array
- Dim teamName() As String
- Dim seriesCount As Integer
- Private Sub cmdDidTheyWin_Click()
- Dim teamToFind As String, numWon As Integer, series As Integer
- 'Search for World Series won by user's team
- teamToFind = UCase(txtName.Text)
- numWon = 0
- picSeriesWon.Cls
- For series = 1 To seriesCount
- If UCase(teamName(series)) = teamToFind Then
- numWon = numWon + 1
- If numWon = 1 Then
- picSeriesWon.Print "The "; teamName(series);
- picSeriesWon.Print " won the following World Series: ";
- Else
- 'Separate from previous
- picSeriesWon.Print ",";
- If (numWon = 5) Or (numWon = 16) Then
- 'Start a new line at 5th and 16th win
- picSeriesWon.Print
- End If
- End If
- 'First world series played in 1903
- picSeriesWon.Print Str(series + 1902);
- End If
- Next series
- If numWon = 0 Then
- picSeriesWon.Print "The "; teamToFind; " did not win any World Series."
- End If
- End Sub
- Private Sub Form_Load()
- Dim series As Integer
- 'Fill array with World Series winners
- Open App.Path & "\WINNERS.TXT" For Input As #1
- Input #1, seriesCount
- ReDim teamName(1 To seriesCount) As String
- For series = 1 To seriesCount
- Input #1, teamName(series)
- Next series
- Close #1
- End Sub
-